<!DOCTYPE html>
<html>
<head>
    <title>药品查询--中软高科-2015</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap.css"/>
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap-responsive.css"/>
    <link rel="stylesheet" type="text/css" href="../Css/style.css"/>
    <script type="text/javascript" src="../Js/jquery.js"></script>
    <script type="text/javascript" src="../Js/jquery.sorted.js"></script>
    <script type="text/javascript" src="../Js/bootstrap.js"></script>
    <script type="text/javascript" src="../Js/ckform.js"></script>
    <script type="text/javascript" src="../Js/common.js"></script>
    <style type="text/css">
        body {
            padding-bottom: 40px;
        }

        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }


    </style>
</head>
<body>

<form id="myForm" name="drugs" action="index.html" class="definewidth m20">
    <table class="table table-bordered table-hover definewidth m10">
        <thead>
        <tr>
            <th>门诊编号</th>
            <th>病人姓名</th>
            <th>身份证号</th>
            <th>挂号费</th>
            <th>社保号</th>
            <th>手机号</th>
            <th>是否自费</th>
            <th>性别</th>
            <th>年龄</th>
            <th>职业</th>
            <th>是否复诊</th>
            <th>挂号门诊</th>
            <th>主治医生</th>
            <th>备注</th>
            <th>挂号日期</th>
            <th>状态</th>
        </tr>
        </thead>
        <tbody id="tbody">
        </tbody>
    </table>
</form>
<script type="text/javascript">
    loadData();

    function loadData() {
        $.ajax({
            type:"GET",
            url:"/register/getAllRegister",
            success: function(vo){
                let str="";
                let btn = " <tr>\n" +
                    "            <td colspan=\"15\">\n" +
                    "                <button type=\"button\" class=\"btn btn-success\" onclick=\"exportInfo()\">导出</button>\n" +
                    "                导出文件位置:\n" +
                    "                <input type=\"text\" id=\"outStream\" name=\"outStream\" value=\"C:\\Users\\Administrator\\Downloads\">\n" +
                    "                <button type=\"button\" class=\"btn btn-success\" onclick=\"black()\">返回列表</button>\n" +
                    "            </td>\n" +
                    "        </tr>";
                for (let i = 0; i < vo.length; i++)  {
                    let obj = vo[i];
                    let id = obj.id;
                    let registerName = obj.registerName;
                    let idNumber = obj.idNumber;
                    let regPrice = obj.regPrice;
                    let medicalNumber = obj.medicalNumber;
                    let phone = obj.phone;
                    let selfPrice = obj.selfPrice;
                    let sex = obj.sex;
                    let age = obj.age;
                    let profession = obj.profession;
                    let lookDoctor = obj.lookDoctor;
                    let department = obj.department;
                    let doctorId = obj.doctorId;
                    let status = obj.status;
                    let note = obj.note;
                    let registerDate = obj.registerDate;
                    str+='<tr>\n' +
                        '            <td style="vertical-align:middle;">'+id+'</td>\n' +
                        '            <td style="vertical-align:middle;">'+registerName+'</td>\n' +
                        '            <td style="vertical-align:middle;">'+idNumber+'</td>\n' +
                        '            <td style="vertical-align:middle;">'+regPrice+'</td>\n' +
                        '            <td style="vertical-align:middle;">'+medicalNumber+'</td>\n' +
                        '            <td style="vertical-align:middle;">'+phone+'</td>\n' +
                        '            <td style="vertical-align:middle;">'+selfPrice+'</td>\n' +
                        '            <td style="vertical-align:middle;">'+sex+'</td>\n' +
                        '            <td style="vertical-align:middle;">'+age+'</td>\n' +
                        '            <td style="vertical-align:middle;">'+profession+'</td>\n' +
                        '            <td style="vertical-align:middle;">'+lookDoctor+'</td>\n' +
                        '            <td style="vertical-align:middle;">'+department+'</td>\n' +
                        '            <td style="vertical-align:middle;">'+doctorId+'</td>\n' +
                        '            <td style="vertical-align:middle;">'+note+'</td>\n' +
                        '            <td style="vertical-align:middle;">'+registerDate+'</td>\n' +
                        '            <td style="vertical-align:middle;">'+status+'</td>\n' +
                        '        </tr>';
                }
                str+=btn;
                $("#tbody").html(str);
                //填充分页数据
                fillPageData(vo.pageInfo);
            }
        });
    }

    function black() {
        window.location.href="/Medicine/index.html";
    }

    function exportInfo(){
        var outStream = $("#outStream").val();
        if(outStream == ""){
            alert("保存路径为空");
            return false;
        }
        $.ajax({
            type: "POST",
            data: "outStream="+outStream,
            dataType:"json",
            url: "/register/excelInfo",
            success: function (vo) {
                alert(vo.msg)
                if(vo.code==200){
                    black();
                }
            }
        })
    }
</script>
</body>
</html>
